/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package parih_threads;

import java.util.Random;
import parih_threads.Person.Status;

/**
 *
 * @author Drak_kin
 */
public  class Work implements Runnable {
    @Override
    public  void run(){
            Random Random_int=new Random();
            Person smb=new Person(Thread.currentThread().getName(),8*60+ Random_int.nextInt(720));
            while (smb.status!=Status.leave){
                smb.change_status(Parih_threads.chair,
                        Parih_threads.sofa, 
                        Parih_threads.wait_place);
                if (Parih_threads.time>=20*60){
                    System.out.println("Ошибка у человека "+smb.name+" Парихмахерская закрылась");
                    break;
                }
            }
    }
    
}
